<div class="main-wrap">

    <div class="crumb-wrap">
        <div class="crumb-list"><i class="icon-font"></i><a href="#">常用操作</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="">用户管理</a><span class="crumb-step">&gt;</span><span>新增/修改用户</span></div>
    </div>
    <div class="result-wrap">
        <div class="result-content">
            <form action="{:U('Adminuser/set')}" method="post" id="myform" name="myform" onsubmit="return check();">
                <input type="hidden" name="id" value="{$data.id}">
                <input type="hidden" name="act" value="{$act}">
                <table class="insert-tab" width="100%">
                    <tbody>
                    
                    <tr>
                        <th width="120"><i class="require-red">*</i>用户名：</th>
                        <td>
                            <input class="common-text required" name="username" size="30" value="{$data.username}" type="text">
                            <span class="notice red hiden" for="username">请填写用户名</span>
                        </td>
                    </tr>
                    <tr>
                        <th width="120"><i class="require-red">*</i>真实姓名：</th>
                        <td>
                            <input class="common-text required"  name="realname" size="30" value="{$data.realname}" type="text">
                            <span class="notice red hiden" for="realname">请填写真实姓名</span>
                        </td>
                    </tr>
                    <tr>
                        <th width="120"><i class="require-red">*</i>角色：</th>
                        <td>
                            {:frm_out_put($role,'role','option',$data['roleid'])}
                            <span class="notice red hiden" for="role">请选择角色</span>
                        </td>
                    </tr>
                    <tr class="exp-td" style="display: none;">
                        <th width="120"><i class="require-red">*</i>快递类型：</th>
                        <td>

                            {:frm_out_put($express,'express','option',$data['attr'])}
                            <span class="notice red hiden" for="express">请选择快递类型</span>
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>密码：</th>
                        <td>
                            <input class="common-text" name="password" size="30" type="password" value="">
                            <span class="notice red hiden" for="password">请填写密码</span>
                        </td>
                    </tr>
                    <if condition="$act eq 'add'">
                        <tr>
                            <th><i class="require-red">*</i>重复密码：</th>
                            <td>
                                <input class="common-text" name="repassword" size="30" type="password" value="{$data.repassword}">
                                <span class="notice red hiden" for="repassword">请填写再次确认密码</span>
                            </td>
                        </tr>
                    </if>
                    <tr>
                        <th></th>
                        <td>
                            <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                            <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>

</div>
<script type="text/javascript">
    
    function check()
    {
        var username = $('input[name=username]').val(),
            realname = $('input[name=realname]').val(),
            password = $('input[name=password]').val(),
            repassword = $('input[name=repassword]').val(),
            act = $('input[name=act]').val();
        var error = true;
        if(username=='')
        {
            showMsg($('span[for=username]'),true,'');error=false;
        }
        if(realname=='')
        {
            showMsg($('span[for=realname]'),true,'');error=false;
        }
        if(password=='' && act == 'add')
        {
            showMsg($('span[for=password]'),true,'');error=false;
        }
        if(act == 'add')
        {
            if(password != repassword)
            {
                showMsg($('span[for=repassword]'),true,'两次密码不一致');error=false;
            }
        }
        
        return error;
    }

    $('#role').change(function(){
        //快递
        if($(this).val()==3){
            $('.exp-td').show();
        }else{
            $('.exp-td').hide();
        }
    });
    /*window.setTimeOut(function(){
        $('.notice').hide();
    },3000);*/
</script>